56fdb1ec1b7504da7b6a04840e72bc24724a13b6,community/src/main/java/org/neo4j/onlinebackup/ha/AbstractSlave.java,AbstractSlave,AbstractSlave,#String#Map#String#number#,32
Before Change
{
params.put( "backup_slave", "true" );
this.graphDb = new EmbeddedReadOnlyGraphDatabase( path, params );
this.xaDs = (NeoStoreXaDataSource) graphDb.getConfig().getTxModule()
.getXaDataSourceManager().getXaDataSource( "nioneodb" );
this.xaDs.makeBackupSlave();
recover();
jobEater = new JobEater();
logApplier = new LogApplier( xaDs );
jobEater.start();
logApplier.start();
this.masterIp = masterIp;
this.masterPort = masterPort;
masterConnection = new Connection( masterIp, masterPort );
while ( !masterConnection.connected() )
{
if ( masterConnection.connectionRefused() )
{
System.out.println( "Unable to connect to master" );
break;
}
}
if ( masterConnection.connected() )
{
jobEater.addJob( new ConnectToMasterJob( masterConnection, this ) );
}
System.out.println( "At version: " + getVersion() );
}
private void recover()
After Change
{
params.put( "backup_slave", "true" );
this.graphDb = new EmbeddedReadOnlyGraphDatabase( path, params );
XaDataSourceManager xaDsMgr = graphDb.getConfig().getTxModule().
getXaDataSourceManager();
XaDataSource nioneo = xaDsMgr.getXaDataSource( "nioneodb" );
XaDataSource lucene = xaDsMgr.getXaDataSource( "lucene" );
XaDataSource fulltext = xaDsMgr.getXaDataSource( "lucene-fulltext" );
if ( lucene != null && fulltext != null )
{
xaDataSources = new XaDataSource[3];
xaDataSources[0] = nioneo;
xaDataSources[1] = lucene;
xaDataSources[2] = fulltext;
}
else
{
xaDataSources = new XaDataSource[1];
xaDataSources[0] = nioneo;
}
for ( XaDataSource xaDs : xaDataSources )
{
xaDs.makeBackupSlave();
}
recover();
jobEater = new JobEater();
logApplier = new LogApplier( xaDataSources );
jobEater.start();
logApplier.start();
this.masterIp = masterIp;
this.masterPort = masterPort;
masterConnections = new Connection[xaDataSources.length];
for ( int i = 0; i < masterConnections.length; i++ )
{
masterConnections[i] = new Connection( masterIp, masterPort );
while ( !masterConnections[i].connected() )
{
if ( masterConnections[i].connectionRefused() )
{
System.out.println( "Unable to connect to master" );
break;
}
}
if ( masterConnections[i].connected() )
{
String name = "nioneodb";
if ( i == 1 )
{
name = "lucene";
}
else if ( i == 2 )
{
name = "lucene-fulltext";
}
jobEater.addJob( new ConnectToMasterJob( masterConnections[i],
this, name, xaDataSources[i] ) );
}
}
// System.out.println( "At version: " + getVersion() );